package com.bizmda.bizsip.serveradaptor.protocol;

import com.bizmda.bizsip.common.BizException;
import com.bizmda.bizsip.config.AbstractServerAdaptorConfig;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 史正烨
 */
public abstract class AbstractServerProtocolProcessor {
    public static final Map<String,Object> PROTOCOL_TYPE_MAP = new HashMap<>();
    static {
        PROTOCOL_TYPE_MAP.put("java",com.bizmda.bizsip.serveradaptor.protocol.JavaServerProtocolProcessor.class);
        PROTOCOL_TYPE_MAP.put("netty",com.bizmda.bizsip.serveradaptor.protocol.NettyServerProtocolProcessor.class);
        PROTOCOL_TYPE_MAP.put("rabbitmq",com.bizmda.bizsip.serveradaptor.protocol.RabbitmqServerProtocolProcessor.class);
    }

    /**
     * 协议适配处理模块的对外协议对接实现
     * @param inMessage
     * @return
     * @throws BizException
     */
    public abstract byte[] process(byte[] inMessage) throws BizException;

    public void init(AbstractServerAdaptorConfig serverAdaptorConfig) throws BizException {
    }
}
